﻿@model IEnumerable<Resto.CostControl.Core.Query.SiteModule.ViewObject.SiteVO>
 @using Resto.CostControl.WebControl.DWZAdapter
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="@Url.Action("Edit")" target="dialog" title="添加项目点" rel="add" width="790" height="300">
                <span>添加</span></a></li>
            <li><a class="delete" href="@Url.Action("Deletes")" target="selectedTodo" rel="Ids" title="确实要删除这些记录吗?" >
                <span>批量删除</span></a></li>
            @*            <li><a class="icon" href="@DisplaySearchUrl(@ViewBag.SearchData)" id="btnSearch" target="dialog" mask="true" rel="Search"
                title="查询框"><span>高级检索</span></a>
                <input type="hidden" id="queryCondition" />
            </li>*@
        </ul>
        <ul class="toolBar" style="float: right">
            <li>
                <form id="pagerForm" onsubmit="return dwzSearch(this);" action="@Url.Action("Index")" method="post">
                <input type="hidden" name="pageNum" value="@ViewBag.PageNum" />
                <input type="hidden" name="numPerPage" value="@ViewBag.NumPerPage" />
                <input type="hidden" name="orderField" value="@ViewBag.OrderField" />
                <input type="hidden" name="orderDirection" value="@ViewBag.OrderDirection" />
                <input type="hidden" id="searchData" name="searchData" value="@ViewBag.SearchData" />
                <input type="text" id="keywords" name="keywords" alt = "按名称检索" value="@ViewBag.Keywords" size="30" />
                <input type="submit" value="检索" onclick="$(searchData).val(''); alert('dd')" />
                </form>
            </li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="76">
        <thead>
            <tr>
                <th width="28">
                    <input type="checkbox" group="Ids" class="checkboxCtrl">
                </th>
                <th align="center" orderfield="Name">
                    名称
                </th>
                <th width="70" orderfield="PMName">
                    项目经理
                </th>
                <th width="70" orderfield="ChefsName" align="center">
                    厨师长
                </th>
                <th width="100" orderfield="AreaName" align="center">
                    所属区域
                </th>
                <th width="200" align="center">
                    送货地址
                </th>
                <th width="200" align="center">
                    地址
                </th>
                <th width="120" align="center">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr target="Id" rel="@item.ID">
                    <td>
                        <input name="Ids" value="@item.ID" type="checkbox">
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.PMName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.ChefsName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.AreaName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.DeliveryAddress)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.SiteAddress)
                    </td>
                    <td>
                        <a href="@Url.Action("Edit")/@item.ID" target="dialog" title="@item.Name-编辑项目点" rel="@item.ID"  width="790" height="300">
                            修改</a> | <a href="@Url.Action("Delete")/@item.ID" target="ajaxTodo" title="确定要删除（@item.Name）吗?" >
                                删除</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            @Html.DWZDropDownList("NumPerPage", "PageSize", new { @class = "combox", onchange = "navTabPageBreak({numPerPage:this.value})" })
            <span>条，共 @ViewBag.Total 条</span>
        </div>
        <div class="pagination" targettype="navTab" totalcount="@ViewBag.Total" numperpage="@ViewBag.NumPerPage" pageNumShown="0"
            currentpage="@ViewBag.PageNum">
        </div>
    </div>
</div>
@helper DisplayOrder(string field)
    { 
        if (ViewBag.OrderField == field)
        { 
    @: class='@ViewBag.OrderDirection'
     }
}
@helper DisplaySearchUrl(string searchParam)
    { 
        string url = string.Empty;
        if (!string.IsNullOrWhiteSpace(searchParam))
        {
            url = Url.Action("Search") + "?" + HttpUtility.UrlEncode(searchParam);
        }
        else
        {
            url = Url.Action("Search");
        }
    @url
}
